<?php if(!empty($locations)){?>
	<label><?php __('Location'); ?></label>
	<select id="child<?php echo $count;?>" name = "child<?php echo $count;?>">
		<option value=""></option>
		<?php foreach($locations as $location):?>
		<option value="<?php echo $location['JobLocation']['id'];?>"><?php echo $location['JobLocation']['name'];?></option>
		<?php endforeach;?>
	</select>
<?php }?>
<script type="text/javascript">
	$(function(){
		$("#child<?php echo $count;?>").live('change',function(event){
			var company = $(this).attr('value');
			$("#newRow<?php echo $count;?>").remove();
			$('#JobProviderJobLocationId').attr('value',company);
			if(company != ''){
				$(this).closest('div').append('<div id="newRow<?php echo $count;?>"></div>');	
				$('#newRow<?php echo $count;?>').load(__HOST_NAME__ + '/job_locations/get_location/' + company+'/'+<?php echo $count+1;?>,function(){});
			}
		});
	});
</script>